package com.mew.auc.service;

import com.mew.auc.config.MewGameConfig;
import com.mew.auc.provide.RegisterFeignService;
import com.mew.auc.rest.ConfigInfoResponse;
import com.mew.auc.rest.ErrorCodeResponse;
import com.mew.common.dc.db.MewErrorConfigService;
import com.mew.common.entity.config.ErrorCode;
import com.zebra.common.ServerBriefInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author songkui
 */
@Service
@Slf4j
public class ConfigInfoService {

    @Autowired
    private MewErrorConfigService mewErrorConfigService;
    @Autowired
    private RegisterFeignService registerFeignService;

    @Autowired
    private MewGameConfig mewGameConfig;
    /**
     *   获取 错误码信息
     * @return
     */
    public ErrorCodeResponse errorCode(){
        List<ErrorCode> list =  mewErrorConfigService.findErrorCode();
        return ErrorCodeResponse.builder().errorCodeList(list).build();
    }

    /**
     * 获取 游戏配置信息
     * @return
     */
    public ConfigInfoResponse configInfo(){
        ServerBriefInfo serverBriefInfo = registerFeignService.getGateway();
        return ConfigInfoResponse.builder().build().buildData(mewGameConfig, serverBriefInfo);
    }


}
